/**
 * Created by vicket on 2017/4/21.
 */
$(function(){

    //����
    var back=$(".back");
    var bookId=sessionStorage.getItem("bookId");
    back.attr("href","noveldetail.ejs#"+bookId);
    var writeText=$(".writeyourself");
    var sendBtn=$(".send_btn");
    var userId=sessionStorage.getItem("userId");
    var bookId=sessionStorage.getItem("bookId");
    //������
    var windowHeight=$(window).height();
    var maskTip=$(".mask_tip");
    maskTip.height(windowHeight);
    maskTip.css("display","none");
    var maskText=$(".mask_content p");

    //����
    sendBtn.click(function(){
        $.ajax({
            type:'post',
            url:"/api/frontSendComment",
            data:{
                uId:userId,
                bId:bookId,
                comment:writeText.val()
            },
            success:function(result){
                if(result.code==1){
                    maskText.text(result.message);
                    maskTip.css("display","block");
                    setTimeout(function(){
                        maskTip.css("display","none");
                        writeText.val("");

                    },3000);
                }
            }
        })
    })
})